#ifndef __CPPTUTORCONCRETEOBSERVERDIGITALCLOCK_H__
#define __CPPTUTORCONCRETEOBSERVERDIGITALCLOCK_H__

#include "cppTutorObserver.h"
#include "cppTutorConcreteSubjectClockTimer.h"

//=========================================================
// ConcreteObserver class
//
// DigitalClock
//
// It is a ConcreteObserver class and is a child class of
// the Observer class.
//
// It is a digital clock observer. It attaches to a timer
// object of the type Subject at run time. The timer
// object calls DigitalClock member function Update()
// whenever there is a DigitalClock update required.
// DigitalClock obtain current time from the timer object
// by timer object's member functions GetHour(),
// GetMinutes, and GetSecond(). DigitalClock prints out
// the updated time.
//
//=========================================================
class DigitalClock: public Observer
{
    public:
        // establishes the relationship with the input subject by using the Subject class function Attach() 
        DigitalClock(ClockTimer *); 
        // terminates the relationship with the subject by using the Subject class function Detach()
        ~DigitalClock();             

        void Update(Subject *);     // update own time
        void Draw();                // print updated time

    private:
        ClockTimer *_subject;       // maintains a reference to its subject. 
};

#endif //__CPPTUTORCONCRETEOBSERVERDIGITALCLOCK_H__

